<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>事件绑定的修饰符</title>
  <style>
    .box {
      width: 100px;
      height: 100px;
      background-color: orange;
    }
  </style>
</head>
<body>
  <div id="app">
    <div class="box" @click="divClick">
      <button @click.stop="btnClick">按钮</button> <!--当前的click监听会以冒泡的形式被div捕获--><!--使用.stop阻止事件冒泡 -->
    </div>
  </div>
  <script src="../lib/vue.js"></script>
  <script>
    // 使用vue
    const app = Vue.createApp({
      data: function(){
        return {
          message: "hello v-on"
          , counter: 0
          , age: 18
        }
      }
      ,methods: {
        btnClick(event){
          // event.stopPropagation() 可以阻止事件冒泡
          console.log("btnClick")
        }
        , divClick() {
          console.log("divClick")
        }
      }
    }
    )
    // 挂载 
    app.mount("#app")

  </script>

</body>
</html>
